Anillo 3 - OriginalAn interactive fiction by Mel Hython (2009) - the Inform 7 source text | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Home page Contents Previous Next Complete text | Section 4 - 'Libreria' de conversaciones
[-------------------------------------------------- Las que hay en el repositorio no me acaban de encajar, así que me meto en el barullo de hacerme una propia. --------------------------------------------------] ConvTabla is a table-name that varies. ConvTabla is Table of NoConv. Table of NoConv
To decide whether conversacion iniciada: if ConvTabla is Table of NoConv: decide no; otherwise: decide yes. Selecting option is an action applying to one number. Understand "[number]" as selecting option when conversacion iniciada. Before doing anything except selecting option or looking when conversacion iniciada: say "Mejor no hacer nada hasta que termine esta conversación."; stop the action. Instead of looking when conversacion iniciada: try selecting option 0. Carry out selecting option: let N be the number understood; if N is 0: say "Selecciona una de las opciones indicadas."; decir opciones activas en ConvTabla; stop the action; if there is a activado of N in ConvTabla: choose row with activado of N in ConvTabla; otherwise: if there is a numero of -1 in ConvTabla: choose row with numero of -1 in ConvTabla; say "[respuesta entry]"; say line break; say line break; otherwise: say "Selecciona una de las opciones indicadas."; decir opciones activas en ConvTabla; stop the action; say "[seleccion entry]"; say line break; say "[respuesta entry]"; say line break; if numero entry is less than 9000: say line break; quitar activados ConvTabla; nuevas opciones para numero entry en ConvTabla; otherwise: change ConvTabla to Table of NoConv; [FIN] follow extra entry. This is the fake rule: rule succeeds. To quitar activados ( tabla - a table-name ): repeat through tabla: change activado entry to 0. To decir opciones activas en ( tabla - a table-name ): repeat through tabla: if activado entry is not 0: say "[activado entry]) [seleccion entry][line break]". To nuevas opciones para ( num - a number) en ( tabla - a table-name): choose row with numero of num in tabla; let L be activa entry; let N be number of entries of L; let C be 0; say "Respondes:[line break]"; repeat with IND running through L: increase C by 1; choose row with numero of IND in tabla; change activado entry to C; say "[C]) [seleccion entry][line break]". To iniciar conversacion ( tabla - a table-name): [ Marcamos que se inicia ] change ConvTabla to tabla; quitar activados tabla; [ Escogemos el nodo raíz ] choose row with numero of 0 in tabla; say respuesta entry; say line break; say line break; nuevas opciones para 0 en tabla. [Tabla ejemplo] Table of Conversacion Ejemplo
|